<?php
namespace app\service;
use alipay\AopClient;
use alipay\AlipayEcoMycarParkingConfigSetRequest;//停车ISV系统配置接口
use alipay\AlipayEcoMycarParkingConfigQueryRequest;//ISV系统配置查询接口
use alipay\AlipayEcoMycarParkingParkinglotinfoCreateRequest;//录入停车场信息
use alipay\AlipayEcoMycarParkingParkinglotinfoUpdateRequest;//修改停车场信息
use alipay\AlipayEcoMycarParkingEnterinfoSyncRequest;//车辆驶入接口
use alipay\AlipayEcoMycarParkingExitinfoSyncRequest;//车辆驶出接口
use alipay\AlipayEcoMycarParkingVehicleQueryRequest;//车牌查询接口
use alipay\AlipayEcoMycarParkingOrderSyncRequest;//订单同步接口
use alipay\AlipayEcoMycarParkingOrderUpdateRequest;//订单更新接口
use alipay\AlipaySystemOauthTokenRequest;//换取授权访问令牌
use alipay\AlipayTradeCreateRequest;//生成订单
use alipay\AlipayTradeCancelRequest;//删除账单
use alipay\AlipayEcoMycarParkingAgreementQueryRequest;//车牌代扣状态查询
use alipay\AlipayEcoMycarTradeOrderQueryRequest;//车牌代扣状态查询
use alipay\AlipayEcoMycarParkingOrderPayRequest;//停车缴费代扣接口
use alipay\AlipayEcoMycarParkingOrderRefundRequest;//停车代扣退款接口
use alipay\AlipayMarketingCashlessvoucherTemplateCreateRequest;//优惠券模板创建借口
use alipay\AlipayMarketingVoucherSendRequest;//优惠券模板发送接口
use alipay\AlipayMarketingVoucherTemplatedetailQueryRequest;//优惠券模板详情查询接口

use alipay\AlipayEbppInvoiceInfoSendRequest;
class apiparkService{
    const PRIKEYPATH = '/www/wwwroot/parkingcommunity/wugan/prikey.txt';//私钥路径
    const PUBKEYPATH = '/www/wwwroot/parkingcommunity/wugan/pubkey.txt';//支付宝公钥路径

    private $app_id;//支付宝分配给开发者的应用
    private $method;//接口名称
    private $format;//仅支持JSON  no
    private $charset = 'UTF-8';//请求使用的编码格式，如utf-8,gbk,gb2312等
    private $sign_type = 'RSA2';//商户生成签名字符串所使用的签名算法类型，目前支持RSA2和RSA，推荐使用RSA2
    private $sign;//商户请求参数的签名串  no
    private $timestamp;//发送请求的时间，格式"yyyy-MM-dd HH:mm:ss"
    private $version = '1.0';//调用的接口版本，固定为：1.0
    private $app_auth_token;//详见应用授权概述 no
    private $biz_content;//请求参数的集合，最大长度不限，除公共参数外所有请求参数都必须放在这个参数中传递，具体参照各产品快速接入文档

    //第三方应用
    public function getPublicContent(){
        $aop = new AopClient ();
        $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
        $aop->appId = '2018082261155108';
        $aop->rsaPrivateKey = file_get_contents(self::PRIKEYPATH);//私钥路径
        $aop->alipayrsaPublicKey= file_get_contents(self::PUBKEYPATH);//支付宝公钥路径
        $aop->apiVersion = '1.0';
        $aop->signType = 'RSA2';
        $aop->postCharset='UTF-8';
        $aop->format='json';
        return $aop;
    }
   

    //生活号应用
    public function lifegetPublicContent(){
        $aop = new AopClient ();
        $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
        $aop->appId = '2017041406712836';
        $aop->rsaPrivateKey = file_get_contents(self::PRIKEYPATH);//私钥路径
        $aop->alipayrsaPublicKey= file_get_contents(self::PUBKEYPATH);//支付宝公钥路径
        $aop->apiVersion = '1.0';
        $aop->signType = 'RSA2';
        $aop->postCharset='UTF-8';
        $aop->format='json';
        return $aop;
    }
    //换取授权访问令牌
    public function oauthToken($code){
        $aop = $this->lifegetPublicContent();
        $request = new AlipaySystemOauthTokenRequest ();
        $request->setGrantType("authorization_code");
        $request->setCode($code);
        $request->setRefreshToken('');
        $result = $aop->execute ( $request);
        if(property_exists($result,'error_response')){
            $responseNode = 'error_response';
        }else{
            $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";   
        }
        return $result->$responseNode;
    }
    
    //停车ISV系统配置接口
    public function configSet($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent();
        $request = new AlipayEcoMycarParkingConfigSetRequest ();
        $request->setBizContent("{" .
        "\"merchant_name\":\"$data->merchant_name\"," .
        "\"merchant_service_phone\":\"$data->merchant_service_phone\"," .
        "\"account_no\":\"$data->account_no\"," .
        "      \"interface_info_list\":[{" .
        "        \"interface_name\":\"alipay.eco.mycar.parking.userpage.query\"," .
        "\"interface_type\":\"interface_page\"," .
        "\"interface_url\":\"$data->interface_url\"" .
        "        }]," .
        "\"merchant_logo\":\"$data->merchant_logo\"" .
        "  }");
        $result = $aop->execute ($request); 
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //ISV系统配置查询接口
    public function configQuery(){
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingConfigQueryRequest ();
        $request->setBizContent("{" .
        "\"interface_name\":\"alipay.eco.mycar.parking.userpage.query\"," .
        "\"interface_type\":\"interface_page\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //录入停车场信息
    public function parkingCreate($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingParkinglotinfoCreateRequest ();
        $request->setBizContent("{" .
            "\"out_parking_id\":\"$data->out_parking_id\"," .
            "\"parking_address\":\"$data->parking_address\"," .
            "\"parking_lot_type\":\"$data->parking_lot_type\"," .
            "\"parking_poiid\":\"$data->parking_poiid\"," .
            "\"parking_mobile\":\"$data->parking_mobile\"," .
            "\"pay_type\":\"$data->pay_type\"," .
            "\"shopingmall_id\":\"$data->shopingmall_id\"," .
            "\"parking_fee_description\":\"$data->parking_fee_description\"," .
            "\"parking_name\":\"$data->parking_name\"," .
            "\"time_out\":\"$data->time_out\"," .
            "\"agent_id\":\"$data->agent_id\"," .
            "\"mchnt_id\":\"$data->mchnt_id\"" .
            "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
		//return $result;
        return $result->$responseNode;
    }

    //修改停车场信息
    public function parkingUpdate($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingParkinglotinfoUpdateRequest ();
        $request->setBizContent("{" .
        "\"parking_id\":\"$data->parking_id\"," .
        "\"parking_address\":\"$data->parking_address\"," .
        "\"parking_name\":\"$data->parking_name\"," .
        "\"time_out\":\"$data->time_out\"," .
        "\"parking_lot_type\":\"$data->parking_lot_type\"," .
        "\"pay_type\":\"$data->pay_type\"," .
        "\"parking_poiid\":\"$data->parking_poiid\"," .
        "\"parking_mobile\":\"$data->parking_mobile\"," .
        "\"shopingmall_id\":\"$data->shopingmall_id\"," .
        "\"parking_fee_description\":\"$data->parking_fee_description\"," .
        "\"agent_id\":\"$data->agent_id\"," .
        "\"mchnt_id\":\"$data->mchnt_id\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
		
        return $result->$responseNode;
    }
    
    //车辆驶入接口
    public function enterinfo($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingEnterinfoSyncRequest ();
        $request->setBizContent("{" .
        "\"parking_id\":\"$data->parking_id\"," .
        "\"car_number\":\"$data->car_number\"," .
        "\"in_time\":\"$data->in_time\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //车辆驶出接口
    public function exitinfo($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingExitinfoSyncRequest ();
        $request->setBizContent("{" .
        "\"parking_id\":\"$data->parking_id\"," .
        "\"car_number\":\"$data->car_number\"," .
        "\"out_time\":\"$data->out_time\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
 
    }

    //车牌查询接口
    public function vehicleQuery($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingVehicleQueryRequest ();
        $request->setBizContent("{" .
        "\"car_id\":\"$data->car_id\"" .
        "  }");
        $access_token = $data->access_token;
        $result = $aop->execute ($request, $access_token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
	
	public  function create($data){
		$sys_service_provider_id="2088621722997814";//    2088521066336121
		$data = json_decode($data);
        $aop = $this->getPublicContent(); 
        $request = new AlipayTradeCreateRequest ();
        $request->setBizContent("{" .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"total_amount\":$data->total_amount," .
        "\"subject\":\"$data->subject\"," .
        "\"buyer_id\":\"$data->buyer_id\"," .
        "\"promo_params\":{".
            "\"parking_id\":\"$data->parking_lot_id\"".
            "},".
        "\"extend_params\":{" .
            "\"sys_service_provider_id\":\"$sys_service_provider_id\"," .
            "\"industry_reflux_info\":\"{\\\"scene_code\\\":\\\"parking_fee_order\\\",\\\"channel\\\":\\\"common_park_provider\\\",\\\"scene_data\\\":{\\\"license_plate\\\":\\\"$data->car_number\\\",\\\"start_time\\\":\\\"$data->start_time\\\",\\\"parking_lot_id\\\":\\\"$data->parking_lot_id\\\",\\\"parkling_lot_name\\\":\\\"$data->parkling_lot_name\\\",\\\"city_code\\\":\\\"$data->city_code\\\"}}\"" .
            "    },".
        "\"timeout_express\":\"5m\"" .
        "  }");
        $request->setNotifyUrl($data->notifyurl);
        $token = $data->token;
        $result = $aop->execute ($request, null, $token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
	//创建订单
    public function orderCreate($data){
        $data = json_decode($data);
        $aop = $this->getPublicContent(); 
        $request = new AlipayTradeCreateRequest ();
        $data->city_code="640100";
        $request->setBizContent("{" .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"total_amount\":$data->total_amount," .
        "\"subject\":\"$data->subject\"," .
        "\"buyer_id\":\"$data->buyer_id\"," .
        "\"extend_params\":{".
            "\"sys_service_provider_id\":\"2088621722997814\",".
            "\"industry_reflux_info\":\"{\\\"scene_code\\\":\\\"parking_fee_order\\\",\\\"channel\\\":\\\"common_park_provider\\\",\\\"scene_data\\\":{\\\"license_plate\\\":\\\"$data->car_number\\\",\\\"start_time\\\":\\\"$data->start_time\\\",\\\"parking_lot_id\\\":\\\"$data->parking_lot_id\\\",\\\"parkling_lot_name\\\":\\\"$data->parkling_lot_name\\\",\\\"city_code\\\":\\\"$data->city_code\\\"}}\"" .
            "},".
        "\"timeout_express\":\"15d\"" .
        "  }");
        $request->setNotifyUrl($data->notifyurl);
        
        $token = $data->token;
        $result = $aop->execute ($request, null, $token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
	public  function createinvoice($data){
		$sys_service_provider_id="2088621722997814";//    2088521066336121
		$data = json_decode($data);
        $aop = $this->getPublicContent(); 
        $request = new AlipayTradeCreateRequest ();
        $request->setBizContent("{" .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"total_amount\":$data->total_amount," .
        "\"subject\":\"$data->subject\"," .
        "\"buyer_id\":\"$data->buyer_id\"," .
        "\"promo_params\":{".
            "\"parking_id\":\"$data->parking_lot_id\"".
            "},".
        "\"extend_params\":{" .
            "\"sys_service_provider_id\":\"$sys_service_provider_id\"," .
            "\"industry_reflux_info\":\"{\\\"scene_code\\\":\\\"parking_fee_order\\\",\\\"channel\\\":\\\"common_park_provider\\\",\\\"scene_data\\\":{\\\"license_plate\\\":\\\"$data->car_number\\\",\\\"start_time\\\":\\\"$data->start_time\\\",\\\"parking_lot_id\\\":\\\"$data->parking_lot_id\\\",\\\"parkling_lot_name\\\":\\\"$data->parkling_lot_name\\\",\\\"city_code\\\":\\\"$data->city_code\\\"}}\"" .
            "    },".
		"\"invoice_info\":{" . 
            "\"key_info\":{" .
				"\"is_support_invoice\":\"$data->is_support_invoice\",".
				"\"invoice_merchant_name\":\"$data->invoice_merchant_name\",".
				"\"tax_num\":\"$data->tax_num\"".
				"}" .
        "    },".
        "\"timeout_express\":\"5m\"" .
        "  }");
        $request->setNotifyUrl($data->notifyurl);
        $token = $data->token;
        $result = $aop->execute ($request, null, $token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //删除订单
    public function cancel($data){
        $data = json_decode($data);
        $aop = $this->getPublicContent(); 
        $request = new AlipayTradeCancelRequest ();
        $request->setBizContent("{" .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"trade_no\":\"$data->trade_no\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //订单同步接口
    public function orderSync($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingOrderSyncRequest ();
        $request->setBizContent("{" .
        "\"user_id\":\"$data->user_id\"," .
        "\"out_parking_id\":\"$data->out_parking_id\"," .
        "\"parking_name\":\"$data->parking_name\"," .
        "\"car_number\":\"$data->car_number\"," .
        "\"out_order_no\":\"$data->out_order_no\"," .
        "\"order_status\":\"$data->order_status\"," .
        "\"order_time\":\"$data->order_time\"," .
        "\"order_no\":\"$data->order_no\"," .
        "\"pay_time\":\"$data->pay_time\"," .
        "\"pay_type\":\"$data->pay_type\"," .
        "\"pay_money\":\"$data->pay_money\"," .
        "\"in_time\":\"$data->in_time\"," .
        "\"parking_id\":\"$data->parking_id\"," .
        "\"in_duration\":\"$data->in_duration\"," .
        "\"card_number\":\"$data->card_number\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
    
    //订单更新接口
    public function orderUpdate($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingOrderUpdateRequest ();
        $request->setBizContent("{" .
        "\"user_id\":\"$data->user_id\"," .
        "\"order_no\":\"$data->order_no\"," .
        "\"order_status\":\"$data->order_status\"" .
        "  }");
        $result = $aop->execute ($request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //车牌代扣状态查询
    public function agreementQuery($car_number){
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingAgreementQueryRequest ();
        $request->setBizContent("{" .
        "\"car_number\":\"$car_number\"" .
        " }");
        $result = $aop->execute ( $request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //交易订单查询接口
    public function orderQuery($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarTradeOrderQueryRequest ();
        $request->setBizContent("{" .
        "\"biz_trade_no\":\"$data->biz_trade_no\"," .
        "\"trade_no\":\"$data->trade_no\"," .
        "\"out_biz_trade_no\":\"$data->out_biz_trade_no\"" .
        " }");
        $result = $aop->execute ( $request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";  
        return $result->$responseNode;
    }

    //停车缴费代扣接口
    public function orderPay($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEcoMycarParkingOrderPayRequest ();
        $request->setBizContent("{" .
        "\"car_number\":\"$data->car_number\"," .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"subject\":\"$data->subject\"," .
        "\"total_fee\":$data->total_fee," .
        "\"seller_logon_id\":\"$data->seller_logon_id\"," .
        "\"seller_id\":\"$data->seller_id\"," .
        "\"parking_id\":\"$data->parking_id\"," .
        "\"out_parking_id\":\"$data->out_parking_id\"," .
        "\"agent_id\":\"$data->agent_id\"," .
        "\"car_number_color\":\"\"," .
        "\"body\":\"$data->body\"" .
        " }");
        $result = $aop->execute ( $request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
    
    //停车代扣退款接口
    public function orderRefund($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
		$aop = $this->getPublicContent();
        $request = new AlipayEcoMycarParkingOrderRefundRequest ();
        $request->setBizContent("{" .
        "\"order_no\":\"$data->order_no\"," .
        "\"out_order_no\":\"$data->out_order_no\"," .
        "\"out_refund_no\":\"$data->out_refund_no\"," .
        "\"refund_fee\":$data->refund_fee," .
        "\"refund_reason\":\"$data->refund_reason\"" .
        " }");
        //$result = $aop->execute ( $request);
		$token = $data->token;
        $result = $aop->execute ($request, null, $token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
	
	//优惠券模板创建
    public function couponCreat($data)
    {
        $data = json_decode($data);
        $aop = $this->getPublicContent();
        $request = new AlipayMarketingCashlessvoucherTemplateCreateRequest ();
        $request->setBizContent("{" .
        "\"voucher_type\":\"CASHLESS_FIX_VOUCHER\"," .
        "\"brand_name\":\"$data->brand_name\"," .
        "\"publish_start_time\":\"$data->publish_start_time 00:00:00\"," .
        "\"publish_end_time\":\"$data->publish_end_time 23:59:59\"," .
        "\"voucher_valid_period\":\"{\\\"type\\\":\\\"RELATIVE\\\",\\\"duration\\\":\\\"$data->voucher_valid_period\\\",\\\"unit\\\":\\\"DAY\\\"}\"," .
        "\"voucher_available_time\":\"[]\"," .
        "\"out_biz_no\":\"$data->out_biz_no\"," .
         "\"voucher_description\":\"[\\\"1、本券不可兑换现金，不可找零。\\\",\\\"2、每个用户最多可以领取1张。\\\",\\\"3、如果订单发生退款，优惠券无法退还。\\\"]\"," .
        "\"voucher_quantity\":$data->voucher_quantity," .
        "\"amount\":$data->amount," .
        "\"floor_amount\":$data->floor_money," .
        "\"rule_conf\":\"{\\\"PID\\\":\\\"$data->pid\\\"}\"," .
        "\"notify_uri\":\"https://www.zwxtc.zfbzhsq.com/admin/Coupon/couponNotice\"," .
        "}");
        $token = $data->token;
        $result = $aop->execute ( $request,null,$token);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }

    //发放优惠券
    public function couponSend($data)
    {
		$data = json_decode($data);
        $aop = $this->getPublicContent();
        $request = new AlipayMarketingVoucherSendRequest ();
        $request->setBizContent("{" .
            "\"template_id\":\"$data->template_id\"," .
            "\"user_id\":\"$data->user_id\"," .
            "\"out_biz_no\":\"$data->out_biz_no\"," .
            "}");
        $token = $data->property_token;
        $result = $aop->execute ( $request,null,$token);
        if(property_exists($result,'error_response')){
            $responseNode = 'error_response';
        }else{
            $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        }
        return $result->$responseNode;
    }
	//卷模板详情查询
    public function couponDetail($data)
    {
        $data = json_decode($data);
        $aop = $this->getPublicContent();
        $request = new AlipayMarketingVoucherTemplatedetailQueryRequest();
        $request->setBizContent("{" .
            "\"template_id\":\"$data->template_id\"" .
            "}");
        $token = $data->property_token;
        $result = $aop->execute ( $request,null,$token);
        if(property_exists($result,'error_response')){
            $responseNode = 'error_response';
        }else{
            $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        }
        return $result->$responseNode;
    }
	
	//电子发票推送
    public function invoiceSend($data){
        $data = json_decode($data);
        $aop = $this->lifegetPublicContent(); 
        $request = new AlipayEbppInvoiceInfoSendRequest();
        $request->setBizContent("{" .
        "\"m_short_name\":\"$data->m_short_name\"," .
        "\"sub_m_short_name\":\"$data->sub_m_short_name\"," .
        "      \"invoice_info_list\":[{" .
        "        \"apply_id\":\"$data->apply_id\"," .
        "\"invoice_code\":\"$data->invoice_code\"," .
        "\"invoice_no\":\"$data->invoice_no\"," .
        "\"invoice_date\":\"$data->invoice_date\"," .
        "\"sum_amount\":\"$data->sum_amount\"," .
        "\"ex_tax_amount\":\"$data->ex_tax_amount\"," .
        "\"tax_amount\":\"$data->tax_amount\"," .
        "          \"invoice_content\":[{" .
        "            \"item_name\":\"$data->item_name\"," .
        "\"item_no\":\"$data->item_no\"," .
        "\"item_spec\":\"$data->item_spec\"," .
        "\"item_unit\":\"$data->item_unit\"," .
        "\"item_quantity\":\"$data->item_quantity\"," .
        "\"item_unit_price\":\"$data->item_unit_price\"," .
        "\"item_ex_tax_amount\":\"$data->item_ex_tax_amount\"," .
        "\"item_tax_rate\":\"$data->item_tax_rate\"," .
        "\"item_tax_amount\":\"$data->item_tax_amount\"," .
        "\"item_sum_amount\":\"$data->item_sum_amount\"," .
        "\"row_type\":\"0\"" .
        "            }]," .
        "\"out_trade_no\":\"$data->out_trade_no\"," .
        "\"invoice_type\":\"$data->invoice_type\"," .
        "\"invoice_kind\":\"$data->invoice_kind\"," .
        "\"invoice_title\":{" .
        "\"title_name\":\"$data->title_name\"," .
        "\"payer_register_no\":\"$data->payer_register_no\"," .
        "\"payer_address_tel\":\"$data->payer_address_tel\"," .
        "\"payer_bank_name_account\":\"$data->payer_bank_name_account\"" .
        "        }," .
        "\"payee_register_no\":\"$data->payee_register_no\"," .
        "\"payee_register_name\":\"$data->payee_register_name\"," .
        "\"payee_address_tel\":\"$data->payee_address_tel\"," .
        "\"payee_bank_name_account\":\"$data->payee_bank_name_account\"," .
        "\"check_code\":\"$data->check_code\"," .
        "\"out_invoice_id\":\"$data->out_invoice_id\"," .
        "\"ori_blue_inv_code\":\"$data->ori_blue_inv_code\"," .
        "\"ori_blue_inv_no\":\"$data->ori_blue_inv_no\"," .
        "\"file_download_type\":\"$data->file_download_type\"," .
        "\"file_download_url\":\"$data->file_download_url\"," .
        "\"payee\":\"$data->payee\"," .
        "\"checker\":\"$data->checker\"," .
        "\"clerk\":\"$data->clerk\"," .
        "\"invoice_memo\":\"$data->invoice_memo\"," .
        "\"extend_fields\":\"$data->xtend_fields\"" .
        "        }]" .
        "  }");
        $result = $aop->execute ( $request);
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        return $result->$responseNode;
    }
    
}